package main

import (
	"github.com/new_rxgo"
	"fmt"
)

func main(){
	in := rxgo.Froms([]interface{}{1, 2, 3, 4, 5})
	out := rxgo.Reduce(in, func(i interface{}, i2 interface{}) interface{} {
		return i.(int) + i2.(int)
	}, 0)
	for i := range out {
		fmt.Print(i)
		fmt.Print(" ")
	}
	in = rxgo.Froms([]interface{}{1, 2, 3, 4, 5})
	out = rxgo.Count(in)
	for i := range out {
		fmt.Print(i)
		fmt.Print(" ")
	}
	in = rxgo.Froms([]interface{}{1, 2, 3, 4, 5})
	out = rxgo.Sum(in)
	for i := range out {
		fmt.Print(i)
		fmt.Print(" ")
	}
	in = rxgo.Froms([]interface{}{1, 2, 3, 4, 5})
	out = rxgo.Average(in)
	for i := range out {
		fmt.Print(i)
		fmt.Print(" ")
	}
	in = rxgo.Froms([]interface{}{1, 2, 3, 4, 5})
	out = rxgo.Max(in)
	for i := range out {
		fmt.Print(i)
		fmt.Print(" ")
	}
	in = rxgo.Froms([]interface{}{1, 2, 3, 4, 5})
	out = rxgo.Min(in)
	for i := range out {
		fmt.Print(i)
		fmt.Print(" ")
	}
	fmt.Println()
	c1 := rxgo.Froms([]interface{}{1, 1, 1, 2})
	c2 := rxgo.Froms([]interface{}{1, 2, 2, 2})
	ch := rxgo.Concat(c1, c2)
	for i := range ch {
		fmt.Print(i)
		fmt.Print(" ")
	}
	fmt.Println()
	
}